function maxTwoSum(arr){
    if(arr.length < 2){
        throw new Error('arr must be at least 2 elements')
    }

    let firstMax = -Infinity
    let secondMax = -Infinity

    for (let num of arr){
        if(num > firstMax){
            secondMax = firstMax
            firstMax = num
        }else if(num > secondMax){
            secondMax = num
        }
    }
    return firstMax + secondMax
}